﻿#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
struct A
{
	int a;
	short b;
	int c;
	char d;
};
#define OFFSETOF(name,mem) (int)&(((name*)0x400)->mem)-0x400
int main()
{
	printf("%d\n", OFFSETOF(struct A, a));
	printf("%d\n", OFFSETOF(struct A, b));
	printf("%d\n", OFFSETOF(struct A, c));
	printf("%d\n", OFFSETOF(struct A, d));
	return 0;
}






//void func(char str[2])
//{
//	int len = strlen(str);
//	int len1 = sizeof(str);
//	printf("%d %d\n", len1, len);
//}
//#define SWAP(n) (((n&0xaaaaaaaa)>>1)+((n&0x55555555)<<1))
//int main()
//{
//	int n = 0;
//	scanf("%d", &n);
//	int ret = SWAP(n);
//	printf("%d", ret);
//	return 0;
//}






	/*int arr[10] = { 1, -2, 3, 10, -4, 7, 2, -5 };
	int len = sizeof(arr) / sizeof(arr[0]);
	int tmp = 0;
	int max = -10000;
	for (int i = 0; i < len; i++)
	{
		tmp += arr[i];
		max = max>tmp ? max : tmp;
		tmp = tmp < 0 ? 0 : tmp;
	}
	printf("%d", max);*/






	/*int a[5] = { 1, 2, 3, 4, 5 };
	int* p1 = (int*)(&a + 1);
	int* p2 = (int*)((int)a + 1);
	int* p3 = (int*)(int*)(a + 1);
	printf("%d,%x,%d\n", p1[-1], p2[0], p3[1]);*/






	/*int a, x;
	for (a = 0, x = 0; a <= 1 && !x++; a++)
	{
	a++;
	}
	printf("%d %d", a, x);*/





	/*char str[] = "hello";
	func(str);*/





	/*1.左移操作符优先级低于➕；
	int a = 1 << 3 + 2;
	printf("%d\n", a);*/
//	return 0;
//}